package com.ce.domain;

import javax.persistence.*;

/**
 * 客户的实体类
 * <pre>
 *      配置映射关系
 *          1.实体类和表的映射关系
 *             注解 Entity 声明实体类
 *             注解 Table  配置实体类和表的映射关系
 *                  name: 配置数据库表的名称
 *          2.实体类中属性和表中字段的映射关系
 *           注解 Id 生命逐渐的生成策略
 *           注解 GeneratedValue 配置主键的生成策略
 *                  GenerationType.IDENTITY 自增  Mysql
 *                          底层数据库必须支持自动增长
 *                  GenerationType.SEQUENCE 序列  Oracle
 *                          底层数据库必须支持序列
 *                  GenerationType.TABLE
 *                      jpa提供的一种机制，通过一张数据库表的形式帮助我们完成主键自增
 *                  GenerationType.AUTO  有程序自动的帮我们选择主键生成策略
 *           注解 Column 配置属性和字段的映射关系
 *
 *  </pre>
 */
@Entity
@Table(name = "cst_customer")
public class Customer {
    /**
     * 客户的主键
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "cust_id")
    private Long custId;
    /**
     * 客户名称
     */
    @Column(name = "cust_name")
    private String custName;
    /**
     * 客户来源
     */
    @Column(name = "cust_source")
    private String custSource;
    /**
     * 客户级别
     */
    @Column(name = "cust_level")
    private String custLevel;
    /**
     * 客户所属行业
     */
    @Column(name = "cust_industry")
    private String custIndustry;
    /**
     * 客户电话
     */
    @Column(name = "cust_phone")
    private String custPhone;
    /**
     * 客户地址
     */
    @Column(name = "cust_address")
    private String custAddress;

    public Long getCustId() {
        return custId;
    }

    public void setCustId(Long custId) {
        this.custId = custId;
    }

    public String getCustName() {
        return custName;
    }

    public void setCustName(String custName) {
        this.custName = custName;
    }

    public String getCustSource() {
        return custSource;
    }

    public void setCustSource(String custSource) {
        this.custSource = custSource;
    }

    public String getCustLevel() {
        return custLevel;
    }

    public void setCustLevel(String custLevel) {
        this.custLevel = custLevel;
    }

    public String getCustIndustry() {
        return custIndustry;
    }

    public void setCustIndustry(String custIndustry) {
        this.custIndustry = custIndustry;
    }

    public String getCustPhone() {
        return custPhone;
    }

    public void setCustPhone(String custPhone) {
        this.custPhone = custPhone;
    }

    public String getCustAddress() {
        return custAddress;
    }

    public void setCustAddress(String custAddress) {
        this.custAddress = custAddress;
    }

    @Override
    public String toString() {
        return "Customer{" +
                "custId=" + custId +
                ", custName='" + custName + '\'' +
                ", custSource='" + custSource + '\'' +
                ", custLevel='" + custLevel + '\'' +
                ", custIndustry='" + custIndustry + '\'' +
                ", custPhone='" + custPhone + '\'' +
                ", custAddress='" + custAddress + '\'' +
                '}';
    }
}
